import {Injectable} from '@angular/core';
import {HttpService} from '../../../../core/http.service';
import {CommHttpService} from '../../../../core/comm.http.service';
import {SERVERS_NAME} from '../../../../config/config';
import {Observable} from 'rxjs';

@Injectable()
export class DepartEvaluteformService extends CommHttpService {
  protected preUrl = `${SERVERS_NAME.EVALUTE_SERVER}evalute/supervise/`;
  protected preUrl1 = `${SERVERS_NAME.EVALUTE_SERVER}evalute/supervise/classify/`; // 评价分类
  protected preUrl2 = `${SERVERS_NAME.EVALUTE_SERVER}evalute/supervise/item/`; // 评价要点

  constructor(protected http: HttpService) {
    super(http);
  }

  /**********接口部分**********/

  /**
   * 查询学年列表
   */
  year(): Observable<any> {
    return this.http.post({}, `${SERVERS_NAME.SECURITY_SERVER}sys/semester/list`);
  }

  /**
   * 查询学院列表
   */
  getCollege() {
    return this.http.get({}, `${SERVERS_NAME.SECURITY_SERVER}` + 'sys/dept/list');
  }

  // 督导评价表
  getFindall(data): Observable<any> {
    return this.http.post(data, this.preUrl + `findAll`);
  }

  // 复制评价表
  setCopy(data): Observable<any> {
    return this.http.post(data, this.preUrl + `copy`);
  }

  /**
   * 编辑查询分类树
   */
  getTree(data): Observable<any> {
    return this.http.post(data, this.preUrl + `listClassify`);
  }

  /**
   * 预览
   * @param param： param
   */
  buildExam(param): Observable<any> {
    return this.http.post(param, this.preUrl + `buildExam`);
  }

  /**
   * 导入Excel
   *
   * @returns Observable<any>返回值
   * @param data: 数据参数
   */
  importExcel(data: any): Observable<any> {
    return this.http.postFile(data, `${SERVERS_NAME.SAFETY_EDU}` + 'safety/edu/question/import');
  }



  /**
   * 评价分类
   */
  sortCreat(data): Observable<any> {
    return this.http.post(data, this.preUrl1 + `create`);
  }

  sortDelete(data): Observable<any> {
    return this.http.post(data, this.preUrl1 + `delete`);
  }

  sortFindall(data): Observable<any> {
    return this.http.post(data, this.preUrl1 + `findAll`);
  }

  sortUpdate(data): Observable<any> {
    return this.http.post(data, this.preUrl1 + `update`);
  }

  /**
   * 评价分类
   */
  itemPage(data): Observable<any> {
    return this.http.post(data, this.preUrl2 + `page`);
  }

  itemCreat(data): Observable<any> {
    return this.http.post(data, this.preUrl2 + `create`);
  }

  itemDelete(data): Observable<any> {
    return this.http.post(data, this.preUrl2 + `delete`);
  }

  itemFindall(data): Observable<any> {
    return this.http.post(data, this.preUrl2 + `findAll`);
  }

  itemUpdate(data): Observable<any> {
    return this.http.post(data, this.preUrl2 + `update`);
  }

}
